<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>附件管理</title>
	<script type="text/javascript">
		$(document).ready(function() {
			layui.use('table', function(){
				let table = layui.table;
				table.init('layui-filter-table1',{
					escape : false
					,height: getLayuiTableHeight()
					,className: 'layui-table-custom'
					,done: function (res,curr,count){
					}
				});
			});
		});
	</script>
</head>
<body>
<div class="content">
	<sys:message content="${message}"/>
	<div class="card">
		<form:form id="searchForm" class="form-inline"
				   modelAttribute="sysFile" method="post"
				   action="${ctxAdmin}/sys/sysFile/" >
			<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
			<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
			<div class="input-group input-group-sm">
				<div class="input-group-prepend">
					<span class="input-group-text">文件名称</span>
				</div>
				<form:input path="fileName" htmlEscape="false" maxlength="255" class="form-control"/>
			</div>
			<div class="input-group input-group-sm">
				<div class="input-group-prepend">
					<span class="input-group-text">文件类型</span>
				</div>
				<form:input path="fileExt" htmlEscape="false" maxlength="255" class="form-control"/>
			</div>
			<div class="btn-group btn-group-sm ml-1">
				<button id="btnSubmit" type="submit" class="btn btn-primary " onclick="return page();">查询</button>
				<button id="btnReset" type="button" class="btn btn-primary" onclick="resetForm();page();">重置</button>
			</div>
		</form:form>
		<table id="layui-table-id1" lay-filter="layui-filter-table1" style="display: none;">
			<thead>
			<tr>
				<th lay-data="{field:'numbers',type: 'numbers',align:'center',width:40, fixed: 'left'}">#</th>
				<th lay-data="{field:'id',hide:true}">ID</th>
				<th lay-data="{field:'a.host_table'}">宿主表名称</th>
				<th lay-data="{field:'a.host_id'}">宿主表ID</th>
				<th lay-data="{field:'a.file_name'}">文件名称</th>
				<th lay-data="{field:'a.file_path'}">文件路径</th>
				<th lay-data="{field:'a.file_ext',align:'center',width:80}">文件类型</th>
				<th lay-data="{field:'a.file_size',align:'center',width:80}">文件大小</th>
				<%--<th lay-data="{field:'a.target_date',align:'center',width:90}">有效日期</th>
                <th lay-data="{field:'a.sort'}">排序</th>--%>
				<th lay-data="{field:'a.update_date',align:'center',width:125}">更新时间</th>
				<shiro:hasPermission name="sys:files:edit">
					<th lay-data="{field:'opt',width: 120,minWidth:120,fixed:'right'}">操作</th>
				</shiro:hasPermission>
			</tr>
			</thead>
			<tbody>
			<c:forEach items="${page.list}" var="sysFile">
				<tr>
					<td></td>
					<td>${sysFile.id}</td>
					<td>${sysFile.hostTable}</td>
					<td>${sysFile.hostId}</td>
					<td>${sysFile.fileName}</td>
					<td>${sysFile.filePath}</td>
					<td>${sysFile.fileExt}</td>
					<td>${sysFile.fileSize}</td>
						<%--<td><fmt:formatDate value="${sysFile.targetDate}" pattern="yyyy-MM-dd"/></td>
                        <td>${sysFile.sort}</td>--%>
					<td><fmt:formatDate value="${sysFile.updateDate}" pattern="yyyy-MM-dd HH:mm"/></td>
					<shiro:hasPermission name="sys:files:edit">
						<td>
							<a href="${ctxAdmin}/sys/sysFile/download?id=${sysFile.id}" class="btn btn-outline alpha-primary text-primary">下载</a>
							<c:if test="${sysFile.fileExt eq 'pdf'}">
								<a href="#" onclick="popupLayerFull(this,'文件预览')" class="btn btn-outline alpha-primary text-primary"
								   data-url="${ctxAdmin}/sys/sysFile/preview?id=${sysFile.id}">预览</a>
							</c:if>
						</td>
					</shiro:hasPermission>
				</tr>
			</c:forEach>
			</tbody>
		</table>
		<sys:laypage page="${page}"/>
	</div>
</div>
</body>
</html>